from flask import Blueprint, jsonify
from flask_restful import Api, Resource, fields, reqparse, marshal
from ext import cache

# 引入模型


# 创建蓝图
accessory_bp = Blueprint('accessory', __name__, url_prefix='/api/accessory')
api = Api(accessory_bp)

base_result = {
    'success': 0,
    'errors': {},
    'msg': {},
}


# 清空缓存
class CacheOverKill(Resource):
    def get(self):
        cache.clear()

        result = base_result.copy()

        result['success'] = 1
        result['msg'] = '缓存清空成功'
        
        return jsonify(result)

api.add_resource(CacheOverKill, '/cache_over_kill', endpoint='cache_over_kill')